<html>
<head></head>
<js href="__PUBLIC__/Js/jquery-1.10.2.js" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" href="__ROOT__/Public/css/common1.css">
<link rel="stylesheet" href="__ROOT__/Public/css/bootstrap.min.css">
<link rel="stylesheet" href="__ROOT__/Public/css/font-awesome.min.css" />
<link rel="stylesheet" href="__ROOT__/Public/css/ace.min.css" /> 
<title>起始页</title>
<body onload="region_default();" class="login-layout">
<script type="text/javascript">
function loadRegion(sel,grade_id,selName,url){
    jQuery("#"+selName+" option").each(function(){jQuery(this).remove();});
    jQuery("<option value=0>请选择</option>").appendTo(jQuery("#"+selName));
    if(jQuery("#"+sel).val()==0){
        return;
    }
    jQuery.getJSON(url,{pid:jQuery("#"+sel).val(),grade:grade_id},
        function(data){
            if(data){
                jQuery.each(data,function(idx,item){
                    jQuery("<option value="+item.id+">"+item.name+"</option>").appendTo(jQuery("#"+selName));
                });
            }else{
                jQuery("<option value='0'>请选择</option>").appendTo(jQuery("#"+selName));
            }
        }
    );
} 

             function toVaild(){
                 var county = document.getElementById("county").value;
                 if(county == '0'){
                     alert("请选择地址");
                    return false;
                }
                 else{
                     
                     return true;
                 }
             }

</script>
<style type="text/css">
  select{
    width: 240px;
  }
</style>

      <div class="main-content">
        <div class="row">
          <div class="col-sm-10 col-sm-offset-1">
            <div class="login-container">
              <div class="center">
                <h1>
                  <i class="icon-leaf green"></i>
                  <span class="red">红日</span>
                  <span class="white">测土数据查询</span>
                </h1>
              </div>
              <div class="space-8"></div>
              <div class="position-relative">
                <div id="login-box" class="login-box visible widget-box no-border">
                  <div class="widget-body">
                    <div class="widget-main">
                      <h4 class="header blue lighter bigger">
                        <i class="icon-coffee green"></i>
                        请输入要查询的地址
                      </h4>
                      <form action="{:U('Home/Chaxun/Index')}" method="post"  onsubmit="return toVaild();">
                        <fieldset>
                          <label class="block clearfix">
                            <span class="block input-icon input-icon-right">
                              <select name="province" id="province"  onchange="loadRegion('province',2,'city','{:U('Index/getRegion')}');">
                                 <option value="0" selected>省份</option>
                                 <volist name="my" id="vo"> 
                                 <option value="{$vo.id}" >{$vo.name}</option>
                                 </volist>
                              </select> 
                            </span>
                          </label>
            
                          <label class="block clearfix">
                            <span class="block input-icon input-icon-right">
                                <select name="city" id="city"  onchange="loadRegion('city',3,'county','{:U('Index/getRegion')}');">
                                  <option value="0">市</option>
                                </select>
                            </span>
                          </label>
            
                          <label class="block clearfix">
                            <span class="block input-icon input-icon-right">
                              <select name="county" id="county">
                                <option value="0">县</option>
                              </select>
                            </span>
                          </label>
                          <div class="space"></div>
            
                          <div class="clearfix">
                            
                            <button type="submit" class="width-35 pull-right btn btn-sm btn-primary">
                              查询
                            </button>
                          </div>
            
                          <div class="space-4"></div>
                        </fieldset>
                      </form>
                   
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
</body>
</html>